systole.plotly.plot_raw

systole.plotly.plot_raw(signal: Union[pandas.core.frame.DataFrame, List, numpy.ndarray], sfreq: int = 75, type: str = 'ppg', ecg_method: Optional[str] = 'hamilton')Figure[source]

Interactive visualization of PPG signal and systolic peaks detection.

Parameters
signalpandas.DataFrame, numpy.ndarray or list

Dataframe of PPG or ECG signal in the long format. If a data frame is provided, it should contain at least one 'time' and one colum for signal(either 'ppg' or 'ecg'). If an array is provided, it will automatically create a DataFrame using the array as signal and sfreq as sampling frequency.

sfreqint

Signal sampling frequency. Default is set to 75 Hz.

typestr

The type of signal provided. Can be 'ppg' (pulse oximeter) or 'ecg' (electrocardiography). The peak detection algorithm used depend on the type of signal provided.

ecg_methodstr

Peak detection algorithm used by the systole.detection.ecg_peaks() function. Can be one of the following: ‘hamilton’, ‘christov’, ‘engelse-zeelenberg’, ‘pan-tompkins’, ‘wavelet-transform’, ‘moving-average’. The default is ‘hamilton’.

Returns
rawplotly.graph_objects.Figure

Instance of plotly.graph_objects.Figure.

Examples

Plotting PPG recording.

from systole import import_ppg
from systole.plotly import plot_raw
# Import PPG recording as pandas data frame
ppg = import_ppg()
# Only use the first 60 seconds for demonstration
ppg = ppg[ppg.time<60]
plot_raw(ppg)

Plotting ECG recording.

from systole import import_dataset1
from systole.plotly import plot_raw
# Import PPG recording as pandas data frame
ecg = import_dataset1(modalities=['ECG'])
# Only use the first 60 seconds for demonstration
ecg = ecg[ecg.time<60]
plot_raw(ecg, type='ecg', sfreq=1000, ecg_method='pan-tompkins')